﻿@model QLMB.ViewModels.RouteInfo

@{
    ViewBag.Title = "Create Flight";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}


<script language = "javascript" type ="text/javascript">
    $(document).ready(function () {
        $("#MayBay").change(function () {
            if ($(this).val() != 0)
                $(this).attr("class", "valid");
            else
                $(this).attr("class", "input-validation-error");

        });

    });
    document..$("#ThoiGianGianCach_2_").value = 3;
</script>

<h2>CreateFlight</h2>

    <div class = "form" id = "form" style="position: fixed; width: 700px">
    @using (Html.BeginForm())
    {
        int num = Model.dsSanBay.Count;
    <b>@Html.LabelFor(x => x.MaDb):</b>
    @Html.Label(Model.MaDb) <br />

    <span><b>@Html.LabelFor(x => x.TpDi):</b></span>
    <span>@Html.Label(Model.TpDi)</span>

    <span><b>@Html.LabelFor(x => x.TpDen):</b></span>
    <span>@Html.Label(Model.TpDen)</span> <br />
    
    <span> <b>Giờ bay:</b></span>
    <span>@Html.Label(Model.Ngay.ToString())</span>
        
    <span> <b>@Html.LabelFor(x => x.thoigianbay):</b></span>
    <span>@Html.Label(Model.thoigianbay.ToString())
    phút </span>   
        
    <span> <b>@Html.LabelFor(x => x.loaidb):</b></span>
    <span>@Html.Label(Model.loaidb)</span>   <br />
        if (num != 1)
        { 
            <span> <b>@Html.LabelFor(x => x.KhuyenMai):</b></span>
            <span>@Html.EditorFor(x => x.KhuyenMai)</span>   <br />
            <span>@Html.ValidationMessageFor(x=>x.KhuyenMai)</span>
        }    
    <h3>Danh sách chuyến bay</h3>   
        <table>
        <tr>
        <th>Sân bay đi</th>
        <th>Sân bay đến</th>
        <th>Hãng khai thác</th>
        <th>Thời gian bay</th>
        <th>Ngày đi</th>
        <th>Ngày đến</th>
        <th>Máy bay</th>
         @{
        if (num == 1)
        {
                    <th>Thông tin khuyến mãi</th>
        }
         }
        </tr>
    @{
        foreach (var sb in Model.dsSanBay)
        {
            <tr>
            <td>@Html.Label(sb.SbDi)</td>
            <td>@Html.Label(sb.SbDen)</td>
            <td>@Html.Label(sb.HangKhaiThac)</td>
            <td>@Html.Label(sb.ThoiGianBay.ToString()) phút</td>
            <td>@Html.Label(sb.NgayDi.ToString())</td>
            <td>@Html.Label(sb.NgayDen.ToString())</td>
            @{
            if (sb.Maybay != 0)
            {
                    <td>
                    @Html.DropDownListFor(x => x.MayBay, new SelectList(Model.DsMayBay, "Value", "Text"), "  ")<br />
                    @Html.ValidationMessageFor(x => x.MayBay)
                    </td>
            }
            else
            {
                 <td> </td>
            }
            }
            @{
            if (num == 1)
            {
                    <td>@Html.EditorFor(x => x.KhuyenMai) <br />
                    @Html.ValidationMessageFor(x => x.KhuyenMai) <br />
                    </td>
            }
            }
            </tr>
        }
    }
    </table>
    <input type="submit" value="Tạo chuyến bay"/>
    }
    </div>

    

